<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.sql.*" %>
<%@ page import="edu.sctu.User" %><%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2018/5/27
  Time: 19:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>显示所有用户</title>
</head>
<body>
<style type="text/css">
    table{
        border-collapse: collapse;
    }
    td{
        border: 1px solid #000;
        padding: 10px;
    }
</style>
<table>
    <tr>
        <td>编号</td>
        <td>用户名</td>
        <td>密码</td>
        <td>操作1</td>
        <td>操作2</td>
    </tr>
    <tr>
        <td>1</td>
        <td>wangmeng</td>
        <td>123</td>
        <td><a href="userDelete.jsp">删除</a></td>
        <td><a href="userUpdate.jsp">更新</a></td>
    </tr>


        <%!private class Database { public List<User> getUserList() {
    }
    }
%>
        <%
        Database database=new Database();
        List<User> userList=database.getUserList();

        pageContext.setAttribute("userList",userList);


        %>
    <c:forEach var="user" items="${userList}">
    <tr>
        <td>${user.id}</td>
        <td>${user.name}</td>
        <td>${user.password}</td>
        <td><a href="userEdit.jsp?id=${user.id}">更新</a></td>
        <td><a href="/userDelete?id=${user.id}">删除</a></td>
    </tr>
    </c:forEach>
</body>
</html>